package com.bawan.web.happy.user.dao;

import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.HibernateTemplate;

import com.bawan.web.happy.user.entity.UserEntity;

/**
 * <p> Description	: UserDao.java </p>
 * <p> Copyright	: Copyright (c) 2015 by PCI-SUNTEK</p>
 * <p> Author 		: ZCCHUN </p>
 * <p> Create		: 2015年10月22日 下午4:29:40 </p> 
 * <p> version 		: 1.0 </p>
 */
public class UserDao {
	private static final Logger logger = Logger.getLogger(UserDao.class);
	
	private HibernateTemplate hibernateTemplate;
	public UserDao(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}
	public UserDao(){}
	
	public boolean addUser(UserEntity entity) {
		boolean result = false;
		try {
			hibernateTemplate.save(entity);
			result = true;
		} catch (DataAccessException e) {
			logger.error(this.getClass().getName() + "[addUser] error:" + e.getMessage(), e);
		}
		return result;
	}
}
